<!--河南星辰软件科技有限公司
@copyright Copyright (c) 2010~2022 All rights reserved.
-->
<template>
  <div class='app-container'>
    <el-row>
      <el-col :span='22' :xs='24'>
        <el-form ref="form" :model="s_folder" :rules="rules" label-width="100px" id="mvcfm">
          <div class="form-unit">
            <a v-for="dict in s_tree_menu" @click="handleNodeClick(dict)" type='primary'>{{dict.__desc}}></a>
          </div>
          <el-button @click="gotoPage('2F3C0A9C46BF4A7DBA4006460E202D43?&cpopup=reload'+vueparams+'')" type='primary' size="mini">新文件夹</el-button>
          <el-button @click="gotoPage('7C37B97BBA8C47258FB2766704672DE8?&cpopup=reload'+vueparams+'')" type='primary' size="mini">上传文件</el-button>
          <el-button @click="popProductOfficeTecFile('')" type='primary' size="mini">创建文件</el-button>
          <el-button @click="popOfficeFileChoiceFlow('')" type='primary' size="mini">流程文件</el-button>
          <div class="form-unit">
            <span class="mvc-title-left"> 文件夹 </span>
          </div>
          <div class='table table-bordered'>
            <ul mode='vertical'>
              <li v-for="(row, index) in s_folder">
                <img src='images/icons/talent/nopic.jpg' width='23' height='19' />
                <el-link @click="gotoPage('/mes/product/ProductProTechFile?CMID9='+row.folder_id+''+vueparams+'')" type='primary'>{{row.subject}}</el-link>
              </li>
            </ul>
          </div>
          <div class="form-unit">
            <span class="mvc-title-left"> 文件列表 </span>
          </div>
          <el-table :data="s_file">
            <el-table-column label="操作" align="center" width='100' type=''>
              <template slot-scope="scope">
                <el-dropdown trigger="click">
                  <span class="el-dropdown-link">操作<i class="el-icon-arrow-down el-icon--right"></i></span>
                  <el-dropdown-menu slot="dropdown">
                    <el-dropdown-item>
                      <el-link @click="gotoPage('0BD52F8F5AF74219B7B9736CF015CCE2?&CMID4='+scope.row.item_id+''+vueparams+'')">增加版本</el-link>
                    </el-dropdown-item>
                  </el-dropdown-menu>
                </el-dropdown>
              </template>
            </el-table-column>
            <el-table-column label="文件" prop="item_id">
              <template slot-scope="scope">
                <el-link @click="gotoPage('/mes/product/ProductProTechFileVersion?CMID4='+scope.row.item_id+''+vueparams+'')" type='primary'>{{scope.row.subject}}</el-link>
              </template>
            </el-table-column>
            <el-table-column label="类型" prop="client_filename">
            </el-table-column>
            <el-table-column label="尺寸" prop="size">
            </el-table-column>
            <el-table-column label="版本" prop="version">
            </el-table-column>
            <el-table-column label="修改日期" prop="modified">
            </el-table-column>
          </el-table>
          <el-button @click="cate('&CMID9='+scope.row.parent_id+'')" type='primary' size="mini"><i class='fa fa-reply'></i>返回上级</el-button>
        </el-form>
      </el-col>
      <el-col :span='2' :xs='24'>
        <el-menu default-active='active' class='menu-unit'>
          <el-menu-item v-for='item in Container'>
            <el-link @click="gotoMenu(item.url)" :type="'生产工艺'===item.name?'primary':'default'">{{item.page_desc||item.name}}</el-link>
          </el-menu-item>
        </el-menu>
      </el-col>
    </el-row>
    <el-dialog :visible.sync="ProductOfficeTecFileVisible" append-to-body>
      <ProductOfficeTecFile v-if="ProductOfficeTecFileVisible" ref="ProductOfficeTecFile" :popparams="popparams"> </ProductOfficeTecFile>
    </el-dialog>
    <el-dialog :visible.sync="OfficeFileChoiceFlowVisible" append-to-body>
      <OfficeFileChoiceFlow v-if="OfficeFileChoiceFlowVisible" ref="OfficeFileChoiceFlow" :popparams="popparams"> </OfficeFileChoiceFlow>
    </el-dialog>
  </div>
</template>
<script>
  import request from '@/utils/request'
  import ProductOfficeTecFile from "@/views/mes/product/ProductOfficeTecFile";
  import OfficeFileChoiceFlow from "@/views/mes/systemadmin/OfficeFileChoiceFlow";
  export default {
    name: 'ProductProTechFile',
    components: {
      ProductOfficeTecFile,
      OfficeFileChoiceFlow,
    },
    props: ['popparams'],
    data() {
      return {
        ProductOfficeTecFileVisible: false,
        ProductOfficeTecFileValue: null,
        ProductOfficeTecFileDesc: null,
        OfficeFileChoiceFlowVisible: false,
        OfficeFileChoiceFlowValue: null,
        OfficeFileChoiceFlowDesc: null,
        vueparams: this.getVUEParams(""),
        s_folder: [],
        s_file: [],
        s_tree_menu: [],
        loading: false,
        Container: null,
        rules: {}
      }
    },
    created() {
      this.getData();
      this.loadContainerMenu({
        pid: "0DE8485F0D57410993D741446A2B0598",
        name: "工艺编辑器右菜单",
        selected: "生产工艺"
      }, 'Container', this.vueparams);
    },
    updated() {},
    mounted() {},
    methods: {
      getData() {
        request({
          method: 'get',
          url: '/xcapi/VUEAction/mes/product/ProcedureAction/productProTechFile?' + this.vueparams,
        }).then(data => {
          for (var k in data) {
            if (Array.isArray(data[k])) {
              this[k] = data[k];
            } else {
              $.extend(this[k], data[k]);
            }
          }
        })
      },
      popProductOfficeTecFile(params) {
        if (params != "") this.popparams = params + this.vueparams;
        this.ProductOfficeTecFileVisible = !this.ProductOfficeTecFileVisible;
      },
      popOfficeFileChoiceFlow(params) {
        if (params != "") this.popparams = params + this.vueparams;
        this.OfficeFileChoiceFlowVisible = !this.OfficeFileChoiceFlowVisible;
      },
      handleOutline(data) {
        request({
          method: 'get',
          url: '/xcapi/VUEAction/mes/product/ProcedureAction/s_tree_menu?' + this.vueparams,
        }).then(data => {
          this.s_tree_menu = data.s_tree_menu;
          this.s_tree_menu = this.s_tree_menu.reverse();
        })
      },
    },
  }
</script>
